<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>司机管理管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
	$(document).ready(function() {
		$("#btnExport").click(function(){
			top.$.jBox.confirm("确认要导出司机数据吗？","系统提示",function(v,h,f){
				if(v=="ok"){
					$("#searchForm").attr("action","${ctx}/driver/tDrivers/exportall");
					$("#searchForm").submit();
					$("#searchForm").attr("action","${ctx}/driver/tDrivers/tDriversList");
				}
			},{buttonsFocus:1});
			top.$('.jbox-body .jbox-icon').css('top','55px');
		});
		$("#btnImport").click(function(){
			$.jBox($("#importBox").html(), {title:"导入数据", buttons:{"关闭":true}, 
				bottomText:"导入文件不能超过5M，仅允许导入“xls”或“xlsx”格式文件！"});
		});
	});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
    <div id="importBox" class="hide">
		<form id="importForm" action="${ctx}/driver/tDrivers/import" method="post" enctype="multipart/form-data"
			class="form-search" style="padding-left:20px;text-align:center;" onsubmit="loading('正在导入，请稍等...');"><br/>
			<input id="uploadFile" name="file" type="file" style="width:330px"/><br/><br/>　　
			<input id="btnImportSubmit" class="btn btn-primary" type="submit" value="   导    入   "/>
			<a href="${ctx}/driver/tDrivers/import/template">下载模板</a>
		</form>
	</div>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/driver/tDrivers?types=${types}">司机管理列表</a></li>
		<shiro:hasPermission name="driver:tDrivers:edit"><li><a href="${ctx}/driver/tDrivers/form?types=${types}">司机管理添加</a></li></shiro:hasPermission>
		<li ><a href="${ctx}/driver/tDrivers/state?types=${types}">司机调度情况查询</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="TDrivers" action="${ctx}/driver/tDrivers/list/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<input id="types" name="types" type="hidden" value="${types}"/>
		<ul class="ul-form">
		<c:choose>
			<c:when test="${types == 1}">
			<form:input path="office" maxlength="50" type="hidden"/>
			</c:when>
			<c:otherwise>
				<li><label>归属公司：</label>
				<form:select path="office" class="input-medium">
					<option value="">--请选择--</option>
					<form:options items="${fns:getOfficeListByFlatType(\"1\")}" itemLabel="name" itemValue="id" htmlEscape="false" />
				</form:select>
				</li> 
			</c:otherwise>
		</c:choose>
			<li><label>姓名：</label>
			<form:input path="drvname" maxlength="50" class="input-medium"/></li>
			<li><label>手机号：</label><form:input path="mobile" maxlength="50" class="input-medium"/></li>
			<li><label>司机状态：</label><form:select path="assignflag" class="input-medium">
				<option value="">--请选择--</option>
				<form:options items="${fns:getDictList('assignflag')}" itemLabel="label" itemValue="value" htmlEscape="false" />
				</form:select></li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li><input id="btnExport" class="btn btn-primary" type="button" value="导出"/>
			<input id="btnImport" class="btn btn-primary" type="button" value="导入"/>
			</li>
			
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>姓名</th>
				<th>手机号</th>
				<th>司机状态</th>
				<th>驾照类型</th>
				<th>归属</th>
				<shiro:hasPermission name="driver:tDrivers:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="tDrivers">
			<tr>
				<td><a a href="${ctx}/driver/tDrivers/formview?id=${tDrivers.drvssysid}&types=${types}">${tDrivers.drvname}</a></td>
				<td>${tDrivers.mobile}</td>
				<td>${fns:getDictLabel(tDrivers.assignflag, 'assignflag', '无')}</td>
				<td>${fns:getDictLabel(tDrivers.permittype, 'permittype', '无')}</td>
				<td>
					<c:if test="${tDrivers.belong eq '1'}">本公司</c:if>
					<c:if test="${tDrivers.belong eq '0'}">外公司</c:if>
				</td>
				<shiro:hasPermission name="driver:tDrivers:edit"><td>
    				<a href="${ctx}/driver/tDrivers/form?id=${tDrivers.drvssysid}&types=${types}">修改</a>
					<a href="${ctx}/driver/tDrivers/delete?id=${tDrivers.drvssysid}&types=${types}" onclick="return confirmx('确认要删除该司机管理吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>